package com.csg.ses.controller;

import com.csg.ses.common.annotation.LoginToken;
import com.csg.ses.common.utils.CommonUtil;
import com.csg.ses.entity.ses.SysEmployeeEntity;
import com.csg.ses.entity.ses.SysInterfaceLogEntity;
import com.csg.ses.service.ses.SysInterfaceLogService;
import com.csg.ses.vo.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;

/**
 * 接口日志
 * @author wangjun
 * @date 2020-11-18 15:53:40
 */
@RestController
@RequestMapping("/sysInterfaceLog")
@Api(tags = "接口日志接口")
public class SysInterfaceLogController {
    @Autowired
    private SysInterfaceLogService sysInterfaceLogService;

    @ApiOperation(value = "日志监控")
    @GetMapping("/list")
    @LoginToken
    public Result getAllEmp(SysInterfaceLogEntity log, Long current, Long size) {
        if (!CommonUtil.isEmpty(log.getStartTime())) {
            LocalDate.parse(log.getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        }
        if (!CommonUtil.isEmpty(log.getEndTime())) {
            LocalDate.parse(log.getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        }
        return sysInterfaceLogService.selByIsSuccessAndTime(log,current,size);
    }

}